import java.util.Arrays;

public class Test {


    public static void main(String[] args) {
        String str="name=zhangsan&name=lisi";
        String[] strings=str.split("&");
        for(String s:strings){
            System.out.println(s);
            String[] ss=s.split("=");
            for(String ss1:ss){
                System.out.println(ss1);
            }
        }
    }
    public static void main8(String[] args) {
        String str="abc\\de\\f\\g";
        String[] strings=str.split("\\\\");
        for(String s:strings) {
            System.out.println(s);
        }
    }

    public static void main7(String[] args) {
        String str="ababc";
        String ret=str.replace('a','1');
//        System.out.println(ret);

        String ret2=str.replace("ab","kkk");
//        System.out.println(ret2);

        String ret3=str.replaceFirst("ab","kkk");
//        System.out.println(ret3);

        String ret4=str.replaceAll("a","ppp");
        System.out.println(ret4);
    }
    public static void main6(String[] args) {
        //格式化
        String s=String.format("%d-%d-%d",2025,5,1);
        System.out.println(s);
    }

    public static void main5(String[] args) {
        //字符串转字符数组
        String str1="abcd";
        char[] array=str1.toCharArray();
        System.out.println(Arrays.toString(array));
    }
    public static void main4(String[] args) {
        String str1="ABCD";
        String str2=str1.toLowerCase();
        System.out.println(str2);

        String str3="abcDeF";
        String str4=str3.toUpperCase();
        System.out.println(str4);
    }
    public static void main3(String[] args) {
        int data1=Integer.parseInt("1234");//字符串转数字
        double data2=Double.parseDouble("123.456");
        System.out.println(data1);
        System.out.println(data2);
    }
    public static void main2(String[] args) {
        String s1=String.valueOf(1234);//valueOf可以将其他类型转换成string类型
        String s2=String.valueOf(12.34);
        String s3=String.valueOf(true);

        System.out.println(s1);
        System.out.println(s2);
        System.out.println(s3);
    }
    public static void main1(String[] args) {
        String str1="abcd";
        String str2="ABCD";

        char ch=str1.charAt(1);
//        System.out.println(ch);

        int index=str1.indexOf('a',2);
//        System.out.println(index);

        int index2=str1.indexOf("bc",2);
//        System.out.println(index2);

        String str3="bcbcabbca";
        int index3=str3.lastIndexOf('a',5);
        System.out.println(index3);

    }
}

